import { getFunds, matchup, matchedResult } from "@/api/transaction";

const actions = {
  // 资金列表
  getFunds({ commit }, data) {
    return new Promise((resolve, reject) => {
      getFunds(data)
        .then((response) => {
          resolve(response.data.date);
        })
        .catch((error) => {
          reject(error);
        });
    });
  },

  // 撮合匹配
  matchup({ commit }, data) {
    return new Promise((resolve, reject) => {
      matchup(data)
        .then((response) => {
          resolve();
        })
        .catch((error) => {
          reject(error);
        });
    });
  },

  // 匹配结果
  matchedResult({ commit }, data) {
    return new Promise((resolve, reject) => {
      matchedResult(data)
        .then((response) => {
          resolve(response.data.data);
        })
        .catch((error) => {
          reject(error);
        });
    });
  },
};

// 导入
export default {
  namespaced: true, // 匿名空间，要打开
  actions,
};
